import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';

export type ResourceDocument = Resource & Document;

@Schema({ timestamps: { createdAt: true, updatedAt: true } })
export class Resource extends Document {
  @Prop()
  type: string;

  @Prop()
  title: string;

  @Prop()
  moduleName: string;

  @Prop()
  parentId: string;

  @Prop()
  key: string;

  @Prop()
  componentName: string;

  @Prop()
  icon: string;

  @Prop()
  sort: number;
}

export const ResourceSchema = SchemaFactory.createForClass(Resource);
